#!/usr/bin/Rscript
# Usage: Rscript infomap1.r networkfile kcore_output
# The network file should be separated by tab

require(igraph)
args<-commandArgs(TRUE)
data <-read.table(args[1],sep='\t',header=F)
network <- graph.data.frame(data,directed=F)

net_simple <- simplify(network)

# Kcore Table
kc <- coreness(net_simple,mode="all")
write.table(kc,args[2],quote=F,sep='\t',row.names=T,col.names=F)


